/**
 * @Title: CommonEventSubscriber
 * @Package cn.com.artemis.biz.steinsggs.web.eventbus
 * @Description: TODO
 * @author yulin.xu@downjoy.com
 * @date 2017/7/21 14:06
 * @version V1.0
 */
package cn.com.artemis.biz.steinsggs.web.eventbus;

import cn.com.artemis.biz.steinsggs.web.eventbus.event.CommonEvent;
import com.google.common.eventbus.AllowConcurrentEvents;
import com.google.common.eventbus.Subscribe;

/**
 *
 *@ClassName: CommonEventSubscriber
 * @Description: TODO
 * @author yulin.xu@downjoy.com
 * @date 2017/7/21 14:06
 *
 */
public class CommonEventSubscriber {

    @Subscribe
    @AllowConcurrentEvents
    public void handleCommonEvent(CommonEvent event) {
        try {
            Thread.currentThread().sleep(3000);
            System.out.println("str---" + Thread.currentThread().getName() + ": " + event.getName());
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

    @Subscribe
    @AllowConcurrentEvents
    public void handleStr(String str) {
        try {
            Thread.currentThread().sleep(3000);
            System.out.println("str---" + Thread.currentThread().getName() + ": " + str);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

    @Subscribe
    @AllowConcurrentEvents
    public void handleInt(Integer i) {
        try {
            Thread.currentThread().sleep(3000);
            System.out.println("int---" + Thread.currentThread().getName() + ": " + i);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

}
